﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OMS
{   
    public class Trade
    {
        // parts of a Trade
        
        public double tradeID { get; set; }
        public int tradeType { get; set; } // 1 - F MM unhedged
                                            // 2 - Slow F MM
                                            // 3 - Spr MM; very rarely created
                                            // 4 - FS Hedged
                                            // 5 - FS Spr Arb
                                            // 6 - FS Spr Arb Mkt

        public string legOne = "CLX2";
        public string legTwo = "CLZ2";
        public string legThree = "CLX2-CLZ2";

        public double fPos = 0; // unhedged quantities
        public double sPos = 0;
        public double sprPos = 0;
        public double unhedged = 0;

        public long fAvgPrice = 0;
        public long sAvgPrice = 0;
        public long sprAvgPrice = 0;

        // public double initiatePrice { get; set; }
        public int initiateQuantity { get; set; }
        public int initiateLeg { get; set; }
        public int initiateSide { get; set; } // 1 - buy, 2 - sell

        public long ticks { get; set; }
        public DateTime createTime { get; set; }
        public DateTime initiateTime { get; set; }
        
        // status of a trade
        public double mtm1;
        public double mtm2;
        public double mtm3;
        public bool reset = false;
        public int status { get; set; }    // 1 - Newly Generated
                                            // 2 - Orders placed and working 
                                             // 3 - initiated First Leg
                                            // 4 - slippage
                                            // 5 - Closed,
                                            // 6 - 
                                            // 7 - Cancelled
        
        // orders IDs of all the three legs to be maintained
        public Order order1b;
        public Order order1bb;
        public Order order1s;
        public Order order1ss;
        public Order order2b;
        public Order order2bb;
        public Order order2s;
        public Order order2ss;
        public Order order3b;
        public Order order3bb;
        public Order order3s;
        public Order order3ss;

        // prices at which the orders are to be created / modified
        public long p1b, p1bb;
        public long p1s, p1ss;
        public long p2b, p2bb;
        public long p2s, p2ss;
        public long p3b, p3bb;
        public long p3s, p3ss;


        public double closestM50;
        

        // trade constructor for Trade Type: 1, 2, 3 - MM 
        public void CreateTrade (int tradeType, int quantity, long ticks, int initiateSide, double tradeID)
        {
            this.tradeID = tradeID;
            this.status = 1;
           // this.initiatePrice = price;
            this.initiateQuantity = quantity;
            this.initiateSide = initiateSide;
            this.initiateTime = DateTime.Now;
            this.ticks = ticks;
            this.tradeType = tradeType;
        }
    }
}
